cmake_minimum_required(VERSION 3.28)
project(MyCMakeProject)

set(CMAKE_CXX_STANDARD 11) 

if(WIN32)
    SET(Boost_USE_STATIC_LIBS ON)
    SET(Boost_USE_MULTITHREADED ON)  
    SET(Boost_USE_STATIC_RUNTIME OFF)
endif()

find_package(Boost 1.83 REQUIRED COMPONENTS log_setup log)
find_package(OpenSSL REQUIRED)

add_executable(MyCMakeProject
im.h
imMsg.h

src/mysql/MysqlConnectionPool.h
src/mysql/MysqlConnectionPool.cpp
# src/mysql/MysqlDatabase.hpp
# src/mysql/DataMysql.h
# src/mysql/DataMysql.cpp
# src/mysql/Field.h
# src/mysql/Field.cpp
src/mysql/QueryResult.h
src/mysql/QueryResult.cpp

# imChatServer.h
# imChatServer.cpp
# imChatSession.h
# imChatSession.cpp

src/IMLogic.h
src/IMLogic.cpp
src/IMServer.hpp
src/IMSession.h
src/IMSession.cpp
src/IMSessionCache.h
src/IMSessionCache.cpp
src/IMUser.h
src/IMUser.cpp
src/IMUserManager.h
src/IMUserManager.cpp
src/IMGroup.h
src/IMGroup.cpp
# src/IMGroupManager.h
# src/IMGroupManager.cpp
main.cpp

# asio/ioc.cpp
# asio/ioc2.cpp
# asio/ioc3.cpp
# asio/ioc-timer.cpp
# asio/ioc-timer2.cpp
# asio/log.cpp
# asio/lock_callback.cpp
# asio/lock.cpp
# asio/stringbuf.cpp
)

target_link_libraries(MyCMakeProject Boost::boost Boost::log_setup Boost::log OpenSSL::SSL OpenSSL::Crypto)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${Boost_INCLUDE_DIR})

if(APPLE)
    target_link_libraries(MyCMakeProject ${CMAKE_CURRENT_SOURCE_DIR}/lib/mac/libmariadb.3.dylib)
endif() # 后面再添加windows 和linux 的库

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/conf/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/conf/)